#include <stdio.h>
#include <math.h>

int main() {
    double eps;
    scanf("%lf", &eps);

    double a = 0.0;
    int n = 1; 
    double b; 

    while (1) {
        b = 1.0 / (3 * (n - 1) + 1);  
        if (n % 2 == 0) {
            b = -b; 
        }
        a += b; 
        if (fabs(b) <= eps) {
            break;
        }

        n++;  
    }

    printf("sum = %.6f\n", a);

    return 0;
}
